import { ADDRESS_LIST, ADDRESS_INFO, ADDRESS_SAVE, ADDRESS_DELETE } from '@constants/address'

const INITIAL_STATE = {
  addressList: [],
  address: {}
}

export default function address(state = INITIAL_STATE, action) {
  switch(action.type) {
    case ADDRESS_LIST: {
      return {
        ...state,
        addressList: action.payload
      }
    }
    case ADDRESS_INFO: {
      return {
        ...state,
        address: action.payload
      }
    }
    case ADDRESS_SAVE: {
      return { ...state }
    }
    case ADDRESS_DELETE: {
      return { ...state }
    }
    default:
      return state
  }
}
